bitkeeper revision 1.1236.1.130 (4244e3f89CxDxAfTO7Rtb2HsrEirWA)
authordjm@sportsman.spdomain <djm@sportsman.spdomain>
Sat, 26 Mar 2005 04:24:24 +0000 (04:24 +0000)
committerdjm@sportsman.spdomain <djm@sportsman.spdomain>
Sat, 26 Mar 2005 04:24:24 +0000 (04:24 +0000)
DomainU's can now be loaded from domain0 using hypercalls

xen/arch/ia64/domain.c
xen/arch/ia64/hypercall.c
xen/arch/ia64/xenmisc.c
xen/arch/ia64/xensetup.c

index 3e889eb8d4d08e5f9a459c07abe96f082dac58d7..d955efa3f472dadfaf8c598409a724d2a71989bf 100644 (file)
@@ -311,7 +311,8 @@ extern unsigned long vhpt_paddr, vhpt_pend;
 
        pmd = pmd_offset(pgd, mpaddr);
        if (pmd_none(*pmd))
-               pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
+               pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
+//             pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
 
        pte = pte_offset_map(pmd, mpaddr);
        if (pte_none(*pte)) {
@@ -509,14 +510,17 @@ parsedomainelfimage(char *elfbase, unsigned long elfsize, unsigned long *entry)
            return -EINVAL;
        }
 
+#if 0
        /* Find the section-header strings table. */
        if ( ehdr.e_shstrndx == SHN_UNDEF )
        {
            printk("ELF image has no section-header strings table (shstrtab).\n");
            return -EINVAL;
        }
+#endif
 
        *entry = ehdr.e_entry;
+printf("parsedomainelfimage: entry point = %p\n",*entry);
 
        return 0;
 }
@@ -559,17 +563,25 @@ void alloc_domU_staging(void)
                while(1);
        }
        else domU_staging_area = (unsigned long *)__va(domU_staging_start);
-       printf("alloc_domU_staging: domU_staging_start=%p\n",domU_staging_start);
+       printf("alloc_domU_staging: domU_staging_area=%p\n",domU_staging_area);
 
 }
 
+unsigned long
+domU_staging_read_8(unsigned long at)
+{
+       // no way to return errors so just do it
+       return domU_staging_area[at>>3];
+       
+}
+
 unsigned long
 domU_staging_write_32(unsigned long at, unsigned long a, unsigned long b,
        unsigned long c, unsigned long d)
 {
        if (at + 32 > domU_staging_size) return -1;
        if (at & 0x1f) return -1;
-       at >>= 5;
+       at >>= 3;
        domU_staging_area[at++] = a;
        domU_staging_area[at++] = b;
        domU_staging_area[at++] = c;
@@ -796,7 +808,7 @@ int construct_domU(struct domain *d,
                d->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
 
        /* Copy the OS image. */
-       printk("calling loaddomainelfimage\n");
+       printk("calling loaddomainelfimage(%p,%p)\n",d,image_start);
        loaddomainelfimage(d,image_start);
        printk("loaddomainelfimage returns\n");
 
@@ -813,7 +825,11 @@ int construct_domU(struct domain *d,
 // FIXME: When dom0 can construct domains, this goes away (or is rewritten)
 int launch_domainU(unsigned long size)
 {
-       static int next = 100;  // FIXME
+#ifdef CLONE_DOMAIN0
+       static int next = CLONE_DOMAIN0+1;
+#else
+       static int next = 1;
+#endif 
 
        struct domain *d = do_createdomain(next,0);
        if (!d) {
index c87921a75565462f5455dda697590ec75a7f78d9..7634e818dbc1133a0881b9b2b57b198937382c89 100644 (file)
@@ -89,7 +89,6 @@ ia64_hypercall (struct pt_regs *regs)
                        vcpu_get_gr(ed,32),
                        vcpu_get_gr(ed,33));
                break;
-#ifdef DOMU_BUILD_STAGING
            case 0xfffd: // test dummy hypercall
                regs->r8 = launch_domainU(
                        vcpu_get_gr(ed,32));
@@ -102,6 +101,8 @@ ia64_hypercall (struct pt_regs *regs)
                        vcpu_get_gr(ed,35),
                        vcpu_get_gr(ed,36));
                break;
-#endif
+           case 0xfffb: // test dummy hypercall
+               regs->r8 = domU_staging_read_8(vcpu_get_gr(ed,32));
+               break;
        }
 }
index fb9bfea35ec92cb8246e452a65062adbd3b6ccf1..40055983db67e3c56d5371b2729e0d7095f193aa 100644 (file)
@@ -247,10 +247,19 @@ void context_switch(struct exec_domain *prev, struct exec_domain *next)
 //printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 //printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
 //prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
-//printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 //if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
 //if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
+//printk("@@sw %d->%d\n",prev->domain->id,next->domain->id);
        switch_to(prev,next,prev);
+// leave this debug for now: it acts as a heartbeat when more than
+// one domain is active
+{
+static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
+static int i = 100;
+int id = ((struct exec_domain *)current)->domain->id & 0xf;
+if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
+if (!i--) { printk("+",id); cnt[id] = 100; }
+}
        clear_bit(EDF_RUNNING, &prev->ed_flags);
        //if (!is_idle_task(next->domain) )
                //send_guest_virq(next, VIRQ_TIMER);
index 211e1af7fd4612417abba1ccf70d45e26c0194a3..04d1cd5d6678b27e74e99db44b3bd4dcecc2464c 100644 (file)
@@ -297,7 +297,7 @@ printk("About to call construct_dom0()\n");
     dom0_memory_end = ia64_boot_param->initrd_size;
     for (i = 0; i < CLONE_DOMAIN0; i++) {
 printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
-        if ( construct_domN(clones[i], dom0_memory_start, dom0_memory_end,
+        if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
                         0, 
                         0,
                        0) != 0)